package com.foruo.learn.designmode.mediator;

/**
 * 同事类抽象类
 * 需要引入 Mediator
 * @author GaoYuan
 * @date 2018/11/11 上午8:54
 */
public abstract class Colleague {

    /** 中介 */
    private Mediator mediator;

    /** 自己姓名 */
    private String name;
    
    /**
     * 发送消息
     * @author GaoYuan
     * @date 2018/11/11 上午8:55
     */
    public void sendMessage(String msg){
        // 调用中介类的发送方法
        this.getMediator().sendMessage(this, msg);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setMediator(Mediator mediator) {
        this.mediator = mediator;
    }

    public Mediator getMediator() {
        return mediator;
    }
}
